namespace KinonekoSoftware.Studio.Pages.Galleries.Filters
{
    public sealed class FullyGalleryFilter : GalleryFilter
    {
        public override List<InstanceCache> Filter(ICollection<InstanceCache> collection, string searchBy)
        {
            IEnumerable<InstanceCache> iterator;

            if (string.IsNullOrEmpty(searchBy))
            {
                iterator = collection;
            }
            else
            {

                iterator = collection.Where(x => x is not null                 &&
                                                 !string.IsNullOrEmpty(x.Name) &&
                                                 x.Name.Contains(searchBy));

            }

            return iterator.ToList();
        }

        public override string Name => "所有设定";
    }
}